package com.my.screenadapter.View;

import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.my.screenadapter.Base.BaseActivity;
import com.my.screenadapter.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class EditTextActivity extends BaseActivity {

    @BindView(R.id.et1)
    EditText et1;
    @BindView(R.id.et2)
    EditText et2;
    @BindView(R.id.et3)
    EditText et3;
    @BindView(R.id.tv1)
    TextView tv1;
    @BindView(R.id.activity_edit_text)
    LinearLayout activityEditText;
    @BindView(R.id.btnEnable)
    Button btnEnable;
    @BindView(R.id.btnDisable)
    Button btnDisable;
    @BindView(R.id.et_onlynumber)
    EditText etOnlynumber;
    @BindView(R.id.et_number)
    EditText etNumber;
    @BindView(R.id.et_numberDec)
    EditText etNumberDec;
    @BindView(R.id.et_settext)
    EditText etSettext;


    @Override
    protected void init() {
        etOnlynumber.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL);
        etNumber.setInputType(InputType.TYPE_CLASS_NUMBER);
        etNumberDec.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL);
        etSettext.setInputType(InputType.TYPE_NULL);
        tv1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(EditTextActivity.this, "tv1", Toast.LENGTH_SHORT).show();
            }
        });
        btnEnable.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TextViewUtils.setEditTextable(true, activityEditText, et1);
                TextViewUtils.setEditTextable(true, btnEnable, btnDisable);
            }
        });
        btnDisable.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                TextViewUtils.setEditTextable(false, et1);
//                TextViewUtils.setEditTextable(true, et2,tv1);
                TextViewUtils.setEditTextable(false, activityEditText, et1);
                TextViewUtils.setEditTextable(true, btnEnable, btnDisable);
            }
        });
    }

    @Override
    protected int initLayoutId() {
        return R.layout.activity_edit_text;
    }


}
